<template>
  <div id="app" v-title data-title="行人步态识别平台">
    <el-container style="border: 1px solid #eee" ref="homePage">
      <el-aside width="210px">
        <el-menu style="min-height: 100%" text-color="#cfcfcf" active-text-color="#0e868a" background-color="#051a2c" default-openeds="{1, 2}">
          <el-menu-item index="0" @click="goTo('/home')" style="text-align: center"><span class="title">GAITREC</span></el-menu-item>
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-menu"></i>行人识别</template>
            <el-menu-item index="1-1" @click="goTo('/realtime')">实时检测</el-menu-item>
            <el-menu-item index="1-2" @click="goTo('/video')">视频检测</el-menu-item>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-menu"></i>数据库</template>
            <el-menu-item index="2-1" @click="goTo('/upload')">上传样本</el-menu-item>
            <el-menu-item index="2-2" @click="goTo('/manager')">向量管理</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container> 
        <el-main>
          <el-page-header @back="goBack"></el-page-header>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      clientHeight: null
    }
  },
  methods: {
    goTo(url) {
      this.$router.replace(url)
    },
    goBack() {
      this.$router.go(-1)
    },
    changeFixed(clientHeight) {
      this.$refs.homePage.$el.style.height = clientHeight + 'px';
    }
  },
  mounted(){
    this.clientHeight = `${document.documentElement.clientHeight}`
    window.onresize = function temp() {
      this.clientHeight = `${document.documentElement.clientHeight}`
    }
  },
  watch: {
    clientHeight: function () {
      this.changeFixed(this.clientHeight)
    }
  }
}
</script>

<style>
body {
  margin: 0;
  margin-left: -1px;
  padding: 0;
}

#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.el-aside {
  color: #333;
  text-align: left;
  background-color: #051a2c;
}

.title {
  font-size: 30px;
  font-weight: 300;
  /* font-family: "Verdana" */
  font-family: "Impact"
  /* font-family: "Caflisch Script" */
}
</style>
